/*
 * @Author: stark
 * @Date: 2022-06-17 20:18:25
 */
$(function () {
    // nav
    $.get(baseUrl + '/system/category', response => {
        let result = response.data;
        let html = '';
        console.log(response);
        result.forEach((item, index) => {
            html += `<li class="menu_item"><a href="#">${item.cateName}</a> <i>  </i>
                <div class="menu_item_nav">`;

            item.children && item.children.forEach(item2 => {
                html += `<dl class="menu_item_nav_two">
                            <dt>
                                <a href="">${item2.cateName}<span>&gt;</span></a>
                            </dt>
                            <dd>`;
                item2.children && item2.children.forEach(item3 => {
                    html += ` <a href="list.html?id=${item3.id}">${item3.cateName}</a>`
                })
                html += `</dd></dl>`;
            })
            html += ` </div></li >`
        })
        // 写入数据
        $("#id").html(html);
    });

    // 今日推荐
    $.get(baseUrl + '/system/recommend', response => {
        let result = response.data.rec;
        let html = '';

        result.forEach(item => {
            html += `
                 <li>
                    <a href="list.html?id=${item.categoryId}">
                        <img src="${item.goodsImg}" alt="">
                        <h3>${item.goodsName}</h3>
                        <p>￥${item.shopPrice}</p>
                    </a>
                </li>`
        });

        $(".recom-bd>ul").html(html);

    });





})
